﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BlogsAPI.Sites.FoursquareSharp
{
    /// <summary>
    /// {"id":"4d22292e5a70a3403ba82c39","createdAt":1294084398,"source":{"name":"foursquare for iPhone",
    /// "url":"https:\/\/foursquare.com\/download\/#\/iphone"},"prefix":"https:\/\/irs1.4sqi.net\/img\/general\/",
    /// "suffix":"\/QG5HP3JNRUYPZYUWGQ55NF4EOS2GAHFDUI2N2GNMURMQQNOG.jpg","width":720,"height":537,"user":{"id":"7146",
    /// "firstName":"Bryan","lastName":"H.","canonicalUrl":"https:\/\/foursquare.com\/bryanhughes",
    /// "photo":{"prefix":"https:\/\/irs3.4sqi.net\/img\/user\/","suffix":"\/ZOQWQ15ZKQQJLXS2.jpg"}},"visibility":"public"}
    /// </summary>
    public class Item
    {
        /// <summary>
        /// фотка, если есть
        /// </summary>
        /// <param name="size">150-150 стандартный размер для инстаграма</param>
        /// <returns></returns>
        public string GetPhoto(string size = "150x150")
        {
            return String.IsNullOrEmpty(Prefix) ? String.Empty : String.Format("{0}{1}{2}", Prefix, size , Suffix);
        }

        /// <summary>
        /// идентификатор 
        /// </summary>
        [JsonMapping("id", JsonMapping.MappingType.Primitive)]
        public string Id { get; set; }
        /// <summary>
        /// Seconds since epoch when this checkin was created.
        /// </summary>
        [JsonMapping("createdAt", JsonMapping.MappingType.Primitive)]
        public DateTime CreatedAt { get; set; }
        /// <summary>
        /// Optional If present, the name and url for the application that created this checkin.
        /// </summary>
        [JsonMapping("source", JsonMapping.MappingType.Class)]
        public Source Source { get; set; }
        /// <summary>
        /// prefix 
        /// </summary>
        [JsonMapping("prefix", JsonMapping.MappingType.Primitive)]
        public string Prefix { get; set; }
        /// <summary>
        /// Suffix 
        /// </summary>
        [JsonMapping("suffix", JsonMapping.MappingType.Primitive)]
        public string Suffix { get; set; }
        /// <summary>
        /// </summary>
        [JsonMapping("width", JsonMapping.MappingType.Primitive)]
        public string Width { get; set; }
        /// <summary>
        /// </summary>
        [JsonMapping("height", JsonMapping.MappingType.Primitive)]
        public string Height { get; set; }
        /// <summary>
        /// </summary>
        [JsonMapping("user", JsonMapping.MappingType.Class)]
        public User User { get; set; }
        /// <summary>
        /// </summary>
        [JsonMapping("visibility", JsonMapping.MappingType.Primitive)]
        public string Visibility { get; set; }
    }
}
